
Page({
  data: {
    songs: []
  },
  linkTo() {
    /*wx.switchTab({
      url: '../comp/index'
    })*/
    wx.navigateTo({
      url: '/pages/logs/logs'
    })
  },
  showModal() {
    wx.showModal({
      title: '提示',
      content: '这是一个模态弹窗',
      // showCancel: false,
      cancelText: 'cancel',
      cancelColor: 'red',
      editable: true,
      success (res) {
        if (res.confirm) {
          console.log('用户点击确定')

          wx.showLoading({
            title: '加载中...',
          })
          setTimeout(function () {
            wx.hideLoading()
          }, 2000)
        } else if (res.cancel) {
          console.log('用户点击取消')
        }
      }
    })
  },
  toTop() {
    wx.pageScrollTo({
      scrollTop: 0
    })
  },
  showActions() {
    wx.showActionSheet({
      itemList: ['相册', '相机', 'C'],
      itemColor: 'red',
      success (res) {
        if(res.tapIndex === 1) {
          // wx.showNavigationBarLoading()
          wx.setNavigationBarTitle({
            title: "相机"
          })
        }
      },
      fail (res) {
        console.log(res.errMsg)
      }
    })
  },
  playMusic(event) {
    const { mid } = event.target.dataset
    console.log(mid)
  },
  onLoad(options) {
    const self = this
    wx.request({
      method: 'GET',
      url: 'https://music.qier222.com/api/search?keywords=赵本山',
      success(res) {
        const { songs } = res.data.result
        console.log(songs)
        self.setData({
          songs,
        })
      }
    })
    // const windowInfo = wx.getWindowInfo()
    // const deviceInfo = wx.getDeviceInfo()
    // console.log(deviceInfo)
    /*wx.showToast({
      title: '暂无网络！',
      icon: 'none', // success, loading
      duration: 5000,
      mask: true
    })*/

  },
  onReady() {

  },
  onShow() {

  },
  onHide() {

  },
  onPullDownRefresh() {

  },
  onReachBottom() {

  },
  onShareAppMessage() {

  }
})